﻿package gui.hug;

import flash.text.TextField;

class HUGSquareGrayButtonDS extends HUGSprite {

	public function new(state : UInt, s : String, w : Float, h : Float) {
		super();
		
		var bc : UInt = 0xB8B8B8; // Border Color
		var tmlc : UInt = 0x9f9f9f; // TopMost Line Color

		var bgc : UInt = 0; // BackGround Color
		var tlc : UInt = 0xffffff; // Top Line Color
		var ibc : UInt = 0xf4f4f4; // Inner Border Color
		var blc : UInt = 0xdfdfdf; // Bottom Line Color

		var tc : UInt = 0; // Text Color
		var tsc : UInt = 0xffffff; // Text Shadow Color

		switch(state) {
			case 1 :
				bgc = Utils.BK_COL;
			case 2 :  // Down state
				bgc = 0xe4e4e4;
				tlc = 0xcccccc;
				ibc = 0xcbcbcb;
				blc = 0xe8e8e8;
			default :  // Out state
				bgc = 0xeaeaea;
		}

		var xx : UInt = (w == 0) ? 10  :  0;
		var fs : UInt = 11; // Font Size

		var txt1 : TextField = Utils.addText(xx, 0, w, fs, s, tsc, Utils.TXT_CENTER);
		var txt2 : TextField = Utils.addText(xx, 0, w, fs, s, tc , Utils.TXT_CENTER);

		if (w == 0)
			w = txt1.textWidth + 24;

		txt2.y = Math.round((h - txt1.textHeight) / 2) - 2;
		txt1.y = txt2.y + 1;

		Utils.rect(this, 0, 0, w, h, bgc, bc);
		Utils.horLine(this, 0, w, 0, tmlc);
		Utils.hollowRect(this, 1, 1, w - 2, h - 2, ibc);
		Utils.horLine(this, 1, w - 1, 1, tlc);
		Utils.horLine(this, 2, w - 2, h - 1, blc);

		addChild(txt1);
		addChild(txt2);
	}
}